package org.apache.james.mime4j.field.address;

import java.util.ArrayList;

public class Mailbox extends Address
{
  private String domain;
  private String localPart;
  private DomainList route;

  public Mailbox(String paramString1, String paramString2)
  {
    this(null, paramString1, paramString2);
  }

  public Mailbox(DomainList paramDomainList, String paramString1, String paramString2)
  {
    this.route = paramDomainList;
    this.localPart = paramString1;
    this.domain = paramString2;
  }

  protected final void doAddMailboxesTo(ArrayList paramArrayList)
  {
    paramArrayList.add(this);
  }

  public String getAddressString()
  {
    return getAddressString(false);
  }

  public String getAddressString(boolean paramBoolean)
  {
    String str1;
    StringBuffer localStringBuffer2;
    String str2;
    StringBuffer localStringBuffer1 = new StringBuffer().append("<");
    if ((!(paramBoolean)) || (this.route == null))
    {
      str1 = "";
      localStringBuffer2 = localStringBuffer1.append(str1).append(this.localPart);
      if (this.domain != null)
        break label104;
      str2 = "";
    }
    while (true)
    {
      while (true)
      {
        return str2 + this.domain + ">";
        str1 = this.route.toRouteString() + ":";
      }
      label104: str2 = "@";
    }
  }

  public String getDomain()
  {
    return this.domain;
  }

  public String getLocalPart()
  {
    return this.localPart;
  }

  public DomainList getRoute()
  {
    return this.route;
  }

  public String toString()
  {
    return getAddressString();
  }
}